package org.apache.flink.runtime.entrypoint.master;

import java.util.concurrent.CompletableFuture;

import javax.annotation.Nullable;

import org.apache.flink.runtime.clusterframework.ApplicationStatus;
import org.apache.flink.runtime.resourcemanager.ResourceManager;
import org.apache.flink.util.AutoCloseableAsync;

/**
 * @类名: MasterComponentOperations
 * @说明: master组件操作
 *
 * @author   leehom
 * @Date	 2023年12月18日 下午7:08:30
 * 修改记录：
 *   > 增加资源消费者
 *
 * @see 	 
 */
public interface MasterComponentOperations extends AutoCloseableAsync {

    public  CompletableFuture<ApplicationStatus> getShutDownFuture();

    /**
     * Deregister the application from the resource management system by signalling the {@link
     * ResourceManager} and also stop the process.
     *
     * @param applicationStatus to terminate the application with
     * @param diagnostics additional information about the shut down, can be {@code null}
     * @return Future which is completed once the shut down
     */
    public CompletableFuture<Void> stopApplication(
            final ApplicationStatus applicationStatus, final @Nullable String diagnostics);

    /**
     * Close the cluster components. This method will not deregister the 
     * application from the resource management and only stop the process.
     *
     * @return Future which is completed once the shut down
     */
    public CompletableFuture<Void> stopProcess();

    // 异步关闭master组件
    public CompletableFuture<Void> closeAsync();
    
    public int getRestPort();

}
